/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author xuanthuy
 */
@Entity
@Table(catalog = "AlluringDecors", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Domain.findAll", query = "SELECT d FROM Domain d"),
    @NamedQuery(name = "Domain.findByDomainID", query = "SELECT d FROM Domain d WHERE d.domainID = :domainID"),
    @NamedQuery(name = "Domain.findByName", query = "SELECT d FROM Domain d WHERE d.name = :name"),
    @NamedQuery(name = "Domain.findByStatus", query = "SELECT d FROM Domain d WHERE d.status = :status"),
    @NamedQuery(name = "Domain.findByDescriptions", query = "SELECT d FROM Domain d WHERE d.descriptions = :descriptions")})
public class Domain implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "Domain_ID", nullable = false)
    private Integer domainID;
    @Size(max = 255)
    @Column(length = 255)
    private String name;
    private Boolean status;
    @Size(max = 1073741823)
    @Column(length = 1073741823)
    private String descriptions;
    @OneToMany(mappedBy = "domainID")
    private List<Service> serviceList;

    public Domain() {
    }

    public Domain(Integer domainID) {
        this.domainID = domainID;
    }

    public Integer getDomainID() {
        return domainID;
    }

    public void setDomainID(Integer domainID) {
        this.domainID = domainID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public String getDescriptions() {
        return descriptions;
    }

    public void setDescriptions(String descriptions) {
        this.descriptions = descriptions;
    }

    @XmlTransient
    public List<Service> getServiceList() {
        return serviceList;
    }

    public void setServiceList(List<Service> serviceList) {
        this.serviceList = serviceList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (domainID != null ? domainID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Domain)) {
            return false;
        }
        Domain other = (Domain) object;
        if ((this.domainID == null && other.domainID != null) || (this.domainID != null && !this.domainID.equals(other.domainID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Domain[ domainID=" + domainID + " ]";
    }
    
}
